<?php
/*
---------------------------------------------------------------------
- 功能描述: 反馈管理
- 文件名:sysController.php
- 版本: 1.0
- 原作者:robot2014/9/4
---------------------------------------------------------------------
*/

class xuanyouUserController extends Base
{

	/**
	* 构造函数
	*
	* @access public
	* @param
	* @return void
	*/
	public function __construct()
	{
		//是否登录
		if(!Admin::isAdminLogin())
		{
			Common::header("/login.html");
		}

		//自定义分页
		Admin::loadCustom();
	}

	/**
	* 反馈审核
	*
	* @access public
	* @param  void
	* @return void
	*/
	public function feedbackAction()
	{
		$this->page->PerPage = $_SESSION['libvar']['pageset'];
		$this->page->Page = parent::$args['page'];

		$aRes = $this->user_feedbackModule->listFeedback($this->page);

		$this->smarty->assign("infolist", $aRes);
		$this->smarty->assign("pagecount", $this->page->Count);
		$this->smarty->assign("page", $this->page->getPage());
		$this->smarty->display("admin/user/feedback_list.html");
	}

	/**
	* 反馈审核
	*
	* @access public
	* @param  void
	* @return void
	*/
	public function viewAction()
	{
		$aRes = $this->user_feedbackModule->getFeedback(parent::$args['id']);

		$this->smarty->assign("info", $aRes);
		$this->smarty->display("admin/user/feedback_view.html");
	}

	/**
	* 删除反馈
	*
	* @access public
	* @param  void
	* @return void
	*/
	public function optAction()
	{
		//删除信息
		if($_POST['act'] == '删除')
		{
			if(!$_POST['ids'][0])
			{
				Common::show("请至少选择1条信息。");
			}
			foreach($_POST['ids'] as $id)
			{
				$this->user_feedbackModule->delFeedback($id);
			}
		}
		else if(parent::$args['act'] == 'del')
		{
			$this->user_feedbackModule->delFeedback(parent::$args['id']);
		}

		Common::forward($_SERVER['HTTP_REFERER'], "parent");
	}

	/**
	* 选油日志
	*
	* @access public
	* @param  void
	* @return void
	*/
	public function postlogAction()
	{
		switch(parent::$args['act'])
		{
			case "ip": $aKey = array("ip"=>parent::$args['z']); break;
			case "cookie": $aKey = array("cookie"=>parent::$args['z']); break;
			default: $aKey = array();
		}

		$this->page->PerPage = $_SESSION['libvar']['pageset'];
		$this->page->Page = parent::$args['page'];

		$aRes = $this->user_postlogModule->listlog($aKey, $this->page);

		$this->smarty->assign("infolist", $aRes);
		$this->smarty->assign("pagecount", $this->page->Count);
		$this->smarty->assign("page", $this->page->getPage());
		$this->smarty->display("admin/user/postlog_list.html");
	}

	/**
	* 查看选油参数
	*
	* @access public
	* @param  void
	* @return void
	*/
	public function viewargsAction()
	{
		$aRes = $this->user_postlogModule->getLog(parent::$args['id']);

		if($aRes)
		{
			$aRes['postcontent'] = Common::assign($aRes['postcontent']);
			$aRes['nextpost']    = Common::assOther($aRes['nextpost'],$aRes["type"]);
			$aRes['ipname']      = Common::getIpLocation($aRes['ip']);
		}

		$this->smarty->assign("info", $aRes);
		$this->smarty->display("admin/user/postlog_view.html");
	}

	/**
	* 发邮箱日志
	*
	* @access public
	* @param  void
	* @return void
	*/
	public function mailAction()
	{
		$aKey = array();

		$this->page->PerPage = $_SESSION['libvar']['pageset'];
		$this->page->Page = parent::$args['page'];

		$aRes = $this->user_mailModule->listlog($aKey, $this->page);

		$this->smarty->assign("infolist", $aRes);
		$this->smarty->assign("pagecount", $this->page->Count);
		$this->smarty->assign("page", $this->page->getPage());
		$this->smarty->display("admin/user/maillog_list.html");
	}

}
?>